package com.djf.djfcs.config;

import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 分片算法配置类
 * 注册自定义分片算法到Spring容器中
 */
@Configuration
public class ShardingAlgorithmConfiguration {

    /**
     * 注册订单表自定义分片算法
     */
    @Bean("CUSTOM_TABLE")
    public ShardingAlgorithm customTableShardingAlgorithm() {
        return new CustomTableShardingAlgorithm();
    }

    /**
     * 注册用户配送表自定义分片算法
     */
    @Bean("CUSTOM_DELIVERY")
    public ShardingAlgorithm customDeliveryShardingAlgorithm() {
        return new CustomDeliveryShardingAlgorithm();
    }
}